<%@page import="com.jsh.util.Tools"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
	String clientIp = Tools.getLocalIp(request);
%>
<!DOCTYPE html>
<!-- release v4.1.8, copyright 2014 - 2015 Kartik Visweswaran -->
<html lang="en">
    <head>
        <meta charset="UTF-8"/>
        <title></title>
        <!-- 指定以IE8的方式来渲染 -->
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
        <link href="<%=path %>/css/bootstrap.min.css" rel="stylesheet">
        <link href="<%=path %>/css/fileinput.css" media="all" rel="stylesheet" type="text/css" />
        <script src="<%=path %>/js/jquery-2.0.3.min.js"></script>
        <script src="<%=path %>/js/fileinput.js" type="text/javascript"></script>
        <script src="<%=path %>/js/bootstrap.min.js" type="text/javascript"></script>
        <script src="<%=path %>/js/fileinput_locale_zh.js" type="text/javascript"></script>
    </head>
    <body>
        <div class="container kv-main">
            
            <br>
            <form  enctype="multipart/form-data">
                
                <div class="form-group">
                    <input id="BomFile" name="BomFile" type="file" multiple class="file">
                </div>

            </form>
        </div>
       
    </body>
	<script>

    $("#BomFile").fileinput({
    	language: 'zh', //设置语言
    	uploadUrl: '<%=path %>/bom/getInfomation.action', // you must set a valid URL here else you will get an error
        allowedFileExtensions: ['xls', 'xlsx'],//接收的文件后缀
        overwriteInitial: false,
        uploadAsync: false, //默认异步上传
        showUpload: true, //是否显示上传按钮
        showPreview : true,     
        browseClass: "btn btn-primary", //按钮样式
        maxFileCount: 1,//最大上传文件数限制
        overwriteInitial: true
	}).on("filebatchuploadsuccess", function(event, data) {
		var jsondata = "";
		if(data.response)
        {
			//jsondata = JSON.stringify(data.response.Header);
			jsondata = encodeURIComponent(JSON.stringify(data.response));
			var url = "<%=path %>/pages/smrp/BOM_Select.jsp?jsondata="+jsondata;
		 	window.location.href= url; 
		 	
 	
        }
        
    });
	</script>
</html>